package com.yq.practice.design.flyweight;

import java.util.HashMap;

/**
 * @ClassName FlyWeightFactory
 * @Description TODO
 * @Author yaoqiang
 * @Date 2021/2/23 9:23
 * @Version 1.0
 */
public class FlyWeightFactory {
    private HashMap<String,ConcreteWeb> pool=new HashMap<>();
    public Web getWeb(String type){
        if (!pool.containsKey(type)){
            pool.put(type,new ConcreteWeb(type));
        }
        return (Web)pool.get(type);
    }
    public void getCount(){
        System.out.println(pool.size());
    }
}
